#include <pf_helper.hpp>
Public Member Functions | |
PFSolverHelper (boost::shared_ptr< PFFactoryModule > factory, boost::shared_ptr< PFNetwork > network) | |
void | update (const math::RealVector &Xcur) |
void | operator() (const math::RealVector &Xcur, math::RealMatrix &theJ) |
void | operator() (const math::RealVector &Xcur, math::RealVector &PQ) |
Public Attributes | |
boost::shared_ptr < PFFactoryModule > | p_factory |
boost::shared_ptr< PFNetwork > | p_network |
boost::shared_ptr < math::RealMatrix > | J |
boost::shared_ptr < math::RealVector > | Xold |
boost::shared_ptr < math::RealVector > | X |
boost::shared_ptr < math::RealVector > | Xdelta |
A helper functor for the powerflow solver. This is a utility functor that provides functions that build the Jacobian and RHS from the network.
gridpack::powerflow::PFSolverHelper::PFSolverHelper | ( | boost::shared_ptr< PFFactoryModule > | factory, | |
boost::shared_ptr< PFNetwork > | network | |||
) |
Constructor The current network state is gathered from the network.
References J, gridpack::powerflow::Jacobian, gridpack::mapper::FullMatrixMap< _network >::mapToRealMatrix(), gridpack::mapper::BusVectorMap< _network >::mapToRealVector(), p_factory, p_network, gridpack::powerflow::State, X, Xdelta, and Xold.
void gridpack::powerflow::PFSolverHelper::operator() | ( | const math::RealVector & | Xcur, | |
math::RealVector & | PQ | |||
) |
Build the RHS function vector. This is called by the nonlinear solver each iteration to build the RHS vector from the current network state. This is also responsible for updating the network state with the current solution estimate, which assumes that it is called only once per solver iteration. This may not be true if certain methods are used or if a finite difference Jacobian is computed by the solver.
Xcur | current state estimate | |
PQ | computed RHS vector |
References gridpack::mapper::BusVectorMap< _network >::mapToRealVector(), p_factory, p_network, gridpack::powerflow::RHS, and update().
void gridpack::powerflow::PFSolverHelper::operator() | ( | const math::RealVector & | Xcur, | |
math::RealMatrix & | theJ | |||
) |
Build the Jacobian Matrix. This is called by the nonlinear solver each iteration to build the Jacobian from the current network state.
Xcur | current state estimate | |
J | Jacobian |
References gridpack::powerflow::Jacobian, gridpack::mapper::FullMatrixMap< _network >::mapToRealMatrix(), p_factory, and p_network.
void gridpack::powerflow::PFSolverHelper::update | ( | const math::RealVector & | Xcur | ) |
Push the current estimated state back onto the network. The network state (voltage, phase) is updated with the current estimate from the nonlinear solver.
FIXME: The problem here is that ...mapToBus expects the CHANGE (old - current)? in state variables. IMHO, there should be a way to set the state variables directly. The solver should be responsible for making the entire estimate.
Xcur | current state estimate from the solver |
References gridpack::mapper::BusVectorMap< _network >::mapToBus(), p_factory, p_network, gridpack::powerflow::RHS, Xdelta, and Xold.
boost::shared_ptr<math::RealMatrix> gridpack::powerflow::PFSolverHelper::J |
boost::shared_ptr<PFFactoryModule> gridpack::powerflow::PFSolverHelper::p_factory |
boost::shared_ptr<PFNetwork> gridpack::powerflow::PFSolverHelper::p_network |
boost::shared_ptr<math::RealVector> gridpack::powerflow::PFSolverHelper::X |
The current network state estimate. This vector provides a space for the nonlinear solve to store the current solution estimate. It should be filled with the initial condition, handed to the nonlinear solver, and not changed afterward.
boost::shared_ptr<math::RealVector> gridpack::powerflow::PFSolverHelper::Xdelta |
The difference between the current and previous estimate. See update() for why this is necessary.
boost::shared_ptr<math::RealVector> gridpack::powerflow::PFSolverHelper::Xold |
See update() for why this is necessary.